using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using BReusable.StaticReflection;
using System.Diagnostics;
using BReusable.Containers;
using StarfleetCommanderDomain.Game;

namespace StarfleetCommanderDomain.Game
{
    public class BuildingContainer : EspItemContainer<Building>
    {
        private const string STR_Shipyard = "Shipyard";
        private const string STR_Capitol = "Capitol";
        private const string STR_ResearchLab = "Research Lab";
        private const string STR_MissileSilo = "Missile Silo";
        private const string STR_Factory = "Factory";
        private const string STR_OreWarehouse = "Ore Warehouse";
        private const string STR_CrystalWarehouse = "Crystal Warehouse";
        private const string STR_HydrogenStorage = "Hydrogen Storage";
        private const string STR_Foundry = "Foundry";
		


		/// <summary>
		/// 30*lvl*1.1^lvl+20
		/// </summary>
        private const string STR_OreMine = "Ore Mine";
		/// <summary>
		/// 20*lvl*1.1^level+10
		/// </summary>
        private const string STR_CrystalMine = "Crystal Mine";
		/// <summary>
		/// 12*lvl*(1.1^level)*(-0.002*0+1.28)
		/// </summary>
        private const string STR_HydrogenSynthsizer = "Hydrogen Synthesizer";

        public IEnumerable<string> Buildings = new string[] { STR_Shipyard, STR_Capitol, STR_ResearchLab, STR_MissileSilo, STR_Factory,STR_OreWarehouse,STR_CrystalWarehouse,
		            STR_HydrogenStorage,STR_Foundry,STR_OreMine,STR_CrystalMine,STR_HydrogenSynthsizer};

        public BuildingContainer(LambdaDictionary<string, Building> values,CombatUnitModel abMissile=null,CombatUnitModel ibMissile=null)
            : base(values)
        {
            ABMissile = abMissile;
            IBMissile = ibMissile;
            foreach (var value in values)
            {
                Debug.Assert(Buildings.Contains(value.Key));
            }

        }

        public Building Shipyard { get { return base.GetItemIfExists(STR_Shipyard); } }

        public Building Capitol { get { return base.GetItemIfExists(STR_Capitol); } }

        public Building ResearchLab { get { return base.GetItemIfExists(STR_ResearchLab); } }

        public Building MissileSilo { get { return base.GetItemIfExists(STR_MissileSilo); } }

        public Building Factory { get { return base.GetItemIfExists(STR_Factory); } }

        public Building OreWarehouse { get { return base.GetItemIfExists(STR_OreWarehouse); } }

        public Building CrystalWarehouse { get { return base.GetItemIfExists(STR_CrystalWarehouse); } }

        public Building HydrogenStorage { get { return base.GetItemIfExists(STR_HydrogenStorage); } }

        public Building Foundry { get { return GetItemIfExists(STR_Foundry); } }

        public Building OreMine { get { return GetItemIfExists(STR_OreMine); } }

        public Building CrystalMine { get { return GetItemIfExists(STR_CrystalMine); } }

        public Building HydrogenMine { get { return GetItemIfExists(STR_HydrogenSynthsizer); } }

        public CombatUnitModel ABMissile { get; private set; }
        public CombatUnitModel IBMissile { get; private set; }
    }
}
